package com.sikaryofficial.information.domain.mapping;

import com.sikaryofficial.information.domain.dto.resp.IndustryNewsDTO;
import com.sikaryofficial.information.domain.entity.IndustryNews;
import com.sikaryofficial.system.api.model.infomation.ArticleDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author wuweihong
 * @create 2024/09/18
 * @description: 产业新闻模型映射
 */

@Mapper
public interface IndustryNewsMapping {

    IndustryNewsMapping INSTANCE = Mappers.getMapper(IndustryNewsMapping.class);

    /**
     * 实体映射成DTO
     * @param industryNews
     * @return
     */
    IndustryNewsDTO coverToDTO(IndustryNews industryNews);

    /**
     * 实体映射
     *
     * @param activityReq
     * @return
     */
    @Mapping(source = "articleId", target = "industryNewsId")
    @Mapping(source = "articleParentId", target = "parentId")
    IndustryNews coverToEntity(ArticleDTO activityReq);

    /**
     * 实体映射resp
     *
     * @param activityList
     * @return
     */
    List<IndustryNews> coverToArticleList(List<ArticleDTO> activityList);

}
